package com.epalmpay.controller.channel.datareport;

import com.epalmpay.commom.BaseController;
import com.epalmpay.exception.ApplicationException;
import com.epalmpay.service.shopaccount.IShopAccountService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/** 
 * 说明：数据报表 :营销数据列表
 * 创建人：gwn
 * 创建时间：2017-06-15
 */
@Controller
@RequestMapping(value="/merchant/shopAccount")
public class ShopAccountController extends BaseController{
	
	@Resource
	private IShopAccountService shopAccountService;
	
	/**
	 * 显示商城收入对账数据列表
	 * @param 
	 * @return
	 */
	@RequestMapping(value="/list")
	@ResponseBody
	public List  list (){
		Map map = new HashMap();
		map.put("groupid",getRequest().getParameter("groupid"));
		map.put("searchkey",getRequest().getParameter("searchkey"));
		List result = new ArrayList();
		try {
			result = shopAccountService.getAccountMonthList(map);
		} catch (ApplicationException ae) {
			result = null;
			ae.printStackTrace();
		} catch (Exception e) {
			result = null;
			e.printStackTrace();
		}
		System.out.println(result);
		return result;
	}

	/**
	 * 显示商城收入对账数据列表
	 * @param
	 * @return
	 */
	@RequestMapping(value="/daylist")
	@ResponseBody
	public List  daylist (){
		Map map = new HashMap();
		map.put("groupid",getRequest().getParameter("groupid"));
		map.put("searchkey",getRequest().getParameter("searchkey"));
		List result = new ArrayList();
		try {
			result = shopAccountService.getAccountDayList(map);
		} catch (ApplicationException ae) {
			result = null;
			ae.printStackTrace();
		} catch (Exception e) {
			result = null;
			e.printStackTrace();
		}
		System.out.println(result);
		return result;
	}

	/**
	 * 显示商城收入对账数据列表
	 * @param
	 * @return
	 */
	@RequestMapping(value="/monthlist")
	@ResponseBody
	public List  monthlist(){
		Map map = new HashMap();
		map.put("groupid",getRequest().getParameter("groupid"));
		map.put("searchkey",getRequest().getParameter("searchkey"));
		List result = new ArrayList();
		try {
			result = shopAccountService.getAccountList(map);
		} catch (ApplicationException ae) {
			result = null;
			ae.printStackTrace();
		} catch (Exception e) {
			result = null;
			e.printStackTrace();
		}
		System.out.println(result);
		return result;
	}

}
